<?php

/**
 * 生成随机密码
 * @param int $length	密码长度
 * @return string
 */
function get_business_password( $length = 8 )
{
	$str = substr(md5(time()), 0, $length);

	return $str;
}

/**
 * 使用mysqli接数据库并获取信息
 * @param array	数据库信息数组
 * @return 
 */
function mysqli_connect($database)
{
	$m = new mysqli('localhost', 'root', '', 'uneed_dev');
	if($m->connect_error)
	{
		die('connect_error') . mysqli_connect_error();
	}
	$sql = "SELECT * FROM `crt_users` LIMIT 10 ";
	$result=$m->query($sql);
	if ($result)
	{
		if($result->num_rows>0)
		{
			/* while($row = $result->fetch_array())
			{
				
			} */
			while($row = $result->fetch_all())
			{
				echo '<pre>';
				print_r($row);
				echo '</pre>';
			}
		}
	}
	else	echo "查询失败";
	
	$result->free();
	$m->close();
}